package io.hots.strategy;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yueshibin@cetcbigdata.com
 * @date 2022/9/5 9:20 上午
 */
public class ShardingUserDBConfig {
    public static final List<String> dbFlagList = new ArrayList<>();

    static {
        dbFlagList.add("1");
        dbFlagList.add("2");
    }

    public static String getRandomDbFlag(String id){
        int hashCode = id.hashCode();

        int index = Math.abs(hashCode) % dbFlagList.size();

        return dbFlagList.get(index);
    }
}
